package com.linhui.project.datasource;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.linhui.project.mapper.UserMapper;
import com.linhui.project.model.dto.user.UserQueryRequest;
import com.linhui.project.model.entity.User;
import com.linhui.project.model.vo.UserVO;
import com.linhui.project.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;


/**
 * 用户服务实现类
 *
 * @author: 临晖
 * @since: 2024-05-18
 */
@Service
@Slf4j
public class UserDataSource implements DataSource<UserVO>{

    @Resource
    private UserService userService;



    @Override
    public Page<UserVO> doSearch(String searchText, long pageNum, long pageSize) {
        UserQueryRequest userQueryRequest = new UserQueryRequest();
        userQueryRequest.setUserName(searchText);
        userQueryRequest.setCurrent(pageNum);
        userQueryRequest.setPageSize(pageSize);

        return userService.listUserVOByPage(userQueryRequest);

    }
}




